import {
    createRouter,
    createWebHistory,
} from "vue-router";

const routes = [
    {
        path:'/',
        name: 'waitingPage',
        component:()=>import('../pages/WaitingPage.vue')
    },
    {
        path:'/loginPage',
        name: 'loginPage',
        component:()=>import('../pages/LoginPage.vue')
    },
    {
        path: "/helperPage",
        name: 'helperPage',
        component:()=>import('../pages/HelperPage.vue')
    },
    {
        path:'/userPage',
        name:'userPage',
        component:()=>import('../pages/UserPage.vue'),
        children:[
            {
                path: '',
                name:'userDefault',
                redirect:'/userPage/customerPage'
            },
            {
                path:'customerPage',
                name:'customerPage',
                component:()=>import('../pages/user_children_pages/CustomerPage.vue'),
                children:[
                    {
                        path:'',
                        name:'customerDefault',
                        redirect:'/userPage/customerPage/customerNewTask'
                    },
                    {
                        path: 'customerNewTask',
                        name: 'customerNewTask',
                        component:()=>import('../pages/customer_children_pages/CustomerNewTask.vue')
                    },
                    {
                        path: 'customerPublished',
                        name: 'customerPublished',
                        component:()=>import('../pages/customer_children_pages/CustomerPublished.vue')
                    },
                    {
                        path:'customerDelivering',
                        name: 'customerDelivering',
                        component:()=>import('../pages/customer_children_pages/CustomerDeliving.vue')
                    },
                    {
                        path:'customerDone',
                        name: 'customerDone',
                        component:()=>import('../pages/customer_children_pages/CustomerDone.vue')
                    },
                    {
                        path: 'customerMessage',
                        name: 'customerMessage',
                        component:()=>import('../pages/customer_children_pages/CustomerMessage.vue')
                    }
                ]
            },
            {
                path:'deliverPage',
                name:'deliverPage',
                component:()=>import('../pages/user_children_pages/DeliverPage.vue'),
                children: [
                    {
                        path:'',
                        name:'deliverDefault',
                        redirect:'/userPage/deliverPage/deliverGetOffer'
                    },
                    {
                        path:'deliverGetOffer',
                        name:'deliverGetOffer',
                        component:()=>import('../pages/deliver_children_pages/DeliverGetOffer.vue')
                    },
                    {
                        path:'deliverDelivering',
                        name:'deliverDelivering',
                        component:()=>import('../pages/deliver_children_pages/DeliverDelivering.vue')
                    },
                    {
                        path:'deliverDone',
                        name:'deliverDone',
                        component:()=>import('../pages/deliver_children_pages/DeliverDone.vue')
                    },
                    {
                        path:'deliverMessage',
                        name:'deliverMessage',
                        component:()=>import('../pages/deliver_children_pages/DeliverMessage.vue')
                    },
                ]
            },
            {
                path:'accountPage',
                name:'accountPage',
                component:()=>import('../pages/user_children_pages/AccountPage.vue')
            }
        ]
    },
    {
        path:'/managerPage',
        name:'managerPage',
        component:()=>import('../pages/ManagerPage.vue'),
        children: [
            {
                path: 'manageUser',
                name: 'manageUser',
                component:()=>import('../pages/manager_children_pages/ManageUser.vue')
            },
            {
                path: 'manageOffer',
                name: 'manageOffer',
                component:()=>import('../pages/manager_children_pages/ManageOffer.vue')
            },
            {
                path: 'managerMessage',
                name: 'managerMessage',
                component:()=>import('../pages/manager_children_pages/ManagerMessage.vue')
            }
        ]
    }

]

const router = createRouter({
    history: createWebHistory(), // history模式
    routes,
})

export default router